#!/usr/bin/env python3
"""
MixVideo 现代化无边框GUI启动脚本

基于CustomTkinter的现代化无边框桌面应用
"""

import sys
import os
from pathlib import Path

# 添加项目根目录到Python路径
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))

def check_dependencies():
    """检查依赖"""
    try:
        import customtkinter
        return True
    except ImportError:
        print("❌ CustomTkinter 未安装")
        print("正在自动安装...")
        try:
            import subprocess
            subprocess.check_call([sys.executable, "-m", "pip", "install", "customtkinter"])
            print("✅ CustomTkinter 安装成功")
            return True
        except:
            print("❌ 自动安装失败，请手动运行: pip install customtkinter")
            return False

def create_borderless_app():
    """创建无边框GUI应用"""
    from src.gui.modern_gui.main_window import ModernMainWindow
    # 返回应用实例
    return ModernMainWindow()

def main():
    """主函数"""
    # 检查依赖
    if not check_dependencies():
        return False
    try:
        from src.bootstrap import register_core_services, load_configuration
        load_configuration()
        register_core_services()
        app = create_borderless_app()
        app.mainloop()
        return True
    except Exception as e:
        import traceback
        traceback.print_exc()
        return False

if __name__ == "__main__":
    main()
